package in.freshstart.java.training.arrays;

public class SumOfTwoMatrices {
	public static void main(String[] args) {
		int array1[][] = { { 4, 5, 6 }, { 6, 8, 9 } };
		int array2[][] = { { 5, 4, 6 }, { 5, 6, 7 } };
		System.out.println("Matrix 1 : ");
		for (int i = 0; i < array1.length; i++) {
			for (int j = 0; j < array1[i].length; j++) {
				System.out.print(array1[i][j] + "\t");
			}
			System.out.println();
		}
		System.out.println("Matrix 2 : ");
		for (int i = 0; i < array2.length; i++) {
			for (int j = 0; j < array2[i].length; j++) {
				System.out.print(array2[i][j] + "\t");
			}
			System.out.println();
		}
		System.out.println("Addition of both matrix : ");
		for (int i = 0; i < array1.length; i++) {
			for (int j = 0; j < array1[i].length; j++) {
				System.out.print((array1[i][j] + array2[i][j]) + "\t");
			}
			System.out.println();
		}
	}

}
